package com.heima.model.common.enums;

public enum BehaviorRedisKeyEnum {
    /**
     * 关注行为Key
     */
    FOLLOW_BEHAVIOR_PREFIX("USER_BEHAVIOR:FOLLOW:"),

    /**
     * 粉丝Key
     */
    FANS_PREFIX("USER_FANS:"),

    /**
     * 点赞行为Key
     */
    LIKES_BEHAVIOR_PREFIX("USER_BEHAVIOR:LIKES:"),

    /**
     * 收藏行为Key
     */
    COLLECTION_BEHAVIOR_PREFIX("USER_BEHAVIOR:COLLECTION:"),

    /**
     * 不喜欢行为Key
     */
    UNLIKES_BEHAVIOR_PREFIX("USER_BEHAVIOR:UNLIKES:");

    private final String keyPrefix;

    BehaviorRedisKeyEnum(String keyPrefix) {
        this.keyPrefix = keyPrefix;
    }

    public String getKeyPrefix() {
        return keyPrefix;
    }

    /**
     * 获取完整的Key
     * @param values 可变参数，用于拼接Key
     * @return 完整的Key
     */
    public String buildKey(Object... values) {
        StringBuilder sb = new StringBuilder(keyPrefix);
        for (Object value : values) {
            sb.append(value);
        }
        return sb.toString();
    }
}